
export const actions = {
    'CHANGE_YEAR': Symbol(),
    'CHANGE_MONTH': Symbol(),
    'CHANGE_DAY': Symbol(),
}


export const setYear = (year) => dispatch => {
    setTimeout(() => {//模拟异步
        dispatch({
            type: actions.CHANGE_YEAR,
            data: year
        });
    }, 1000);
}

//使用了redux-thunk插件，推荐的用法
export const setMonth = (month) => dispatch => {
    setTimeout(() => {//模拟异步
        dispatch({
            type: actions.CHANGE_MONTH,
            data: month
        });
    }, 1000)
}

export const setDay = function (day) {
    return function (dispatch, getState) {
        setTimeout(() => {//模拟异步
            dispatch({
                type: actions.CHANGE_DAY,
                data: day
            });
        }, 1000);
    }
}
